<template>
	<view class="page">
		<view class="yl_img_box">
			<!-- <view style="margin-top:12rpx; margin-bottom: 20rpx;">信用卡综合信息查询</view><br> --><view>卡银通，您的查询管家</view>
		</view>
		<view class="title">银联商务机编号
		</view>
		<view style="position: relative;">
			<input type="text" v-model="sn" placeholder-style="input" placeholder="请输入SN机具编码" class="input" />
			<image src="https://orderh5.yt-card.top/images/sm.png" @click="toScan" class="saoma"></image>
		</view>
		
		<view class="submit">
			<view class="cancel" @click="back">
				取消
			</view>
			<view class="sure" @click="searchSure">
				查询
			</view>
		</view>
		<u-modal :show="show" @cancel="show=false" confirmColor="red" confirmText="完成" @confirm="show=false"  :showCancelButton="true">
			<view class="slot-content">
				<view class="feitext">{{resultContent.note1}}</view>
				<view class="feitext">{{resultContent.note2}}</view>
				<view class="feitext">{{resultContent.note3}}</view>
				<view class="note_waring">{{resultContent.note_waring}}</view>
			</view>
		</u-modal>
		<u-modal :show="show2" title="温馨提示" @cancel="show2=false"  cancelText="再逛会" confirmText="去登录" @confirm="toPage"  :showCancelButton="true"  :content='content'>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show:false,
				content:"此时此刻需要您登录喔～",
				show2:false,
				sn:"",
				resultContent:{
					note1:"",
					note2:"",
					note3:"",
					note_waring:""
				}
			}
		},
		onLoad() {
	
		},
		onShow() {
			this.show2=false
		},
		methods: {
			back(){
				uni.navigateBack()
			},
			searchSure(){
				if(!uni.getStorageSync('token')){
					this.show2=true
					return
				}
				if(!this.sn){
					uni.showToast({
						title: '请先输入银联商务机编号',
						icon: 'none',
						mask: true,
					})
					return
				}
				let data={
					sn:this.sn
				}
				this.$request('wechat/query/machine','post',data).then((res)=>{
					if(res.code==200){
						this.resultContent=res.data
						this.show=true
					}
				})
			},
			toPage(){
				uni.navigateTo({
					url:"/pages/userLogin/index"
				})
			},
			toScan(){
				var that=this
				console.log("执行909090");
				uni.scanCode({
					scanType: ['barCode'],
					success: function (res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						that.sn=res.result;
					}
				});
			},
			toLogin(){
				uni.navigateTo({
					url:"/pages/userLogin/index"
				})
			},
			toRegister(){
				uni.navigateTo({
					url:"/pages/userRegister/index"
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	view,input {
		box-sizing: border-box;
	}
	.page {
		height: 100vh;
		background-color: #f0f2f5;
		padding: 40rpx;
		background: url(https://orderh5.yt-card.top/images/bg.png);
		background-size: cover;
		overflow: hidden;
	}
	.yl_img_box{
		width: 100%;
		padding: 40rpx;
		background-color: #fff;
		border-radius: 30rpx;
		height: 200rpx;
		background: linear-gradient(129deg, #39c4fd, #5498e9, #9c73ed, #4ed8b6);
		color: #fff;
		line-height: 120rpx;
	}
	.yl_img{
		width: 100%;
		height: 115rpx;
	}
	.title {
		color: #333;
		font-size: 32rpx;
		margin-top: 40rpx;
		padding-left: 30rpx;
		font-weight: 600;
	}
	.input{
		width: 100%;
		margin-top: 40rpx;
		color: #454545;
		font-size: 28rpx;
		border-radius: 50rpx;
		height: 100rpx;
		border: 1rpx solid #fff;
		padding-left: 30rpx;
		line-height: 100rpx;
		background: #fff;
	}
	.submit{
		margin-top: 50rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		.cancel {
			width: 48%;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			color: rgb(210, 51, 79);
			background-color: #fff;
			font-size: 32rpx;
			border-radius: 50rpx;
			color: #666;
		}
		.sure {
			width: 48%;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			background: linear-gradient(129deg, #379efb, #725bf3);
			color: #fff;
			font-size: 32rpx;
			border-radius: 50rpx;
		}
	}
	.saoma{
		width: 66rpx;
		height: 66rpx;
		position: absolute;
		top: 18rpx;
		right: 42rpx;
		z-index:9999;
	}
	.feitext{
		color: #333;
		font-weight: 600;
		font-size: 28rpx;
	}
	.note_waring{
		margin-top: 60rpx;
		color: #f32d12;
		font-weight: 600;
		font-size: 30rpx;
	}
	</style>